package com.woniuxy.driverschool;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@MapperScan("com.woniuxy.driverschool.mapper")
public class DriverschoolApplication {

    public static void main(String[] args) {
        SpringApplication.run(DriverschoolApplication.class, args);
    }

    @Bean
    public FilterRegistrationBean<CrossOrignFilter> filterFilterRegistrationBean(){
        FilterRegistrationBean<CrossOrignFilter> filterFilterRegistrationBean=
                new FilterRegistrationBean<>();
        filterFilterRegistrationBean.setFilter(new CrossOrignFilter());
        filterFilterRegistrationBean.addUrlPatterns("/*");
        // 设置过滤优先级
        filterFilterRegistrationBean.setOrder(0);
        filterFilterRegistrationBean.setEnabled(true);
        return filterFilterRegistrationBean;
    }
}
